package com.zzqstart.msgservice.controller;


import com.zzqstart.commonutils.R;
import com.zzqstart.msgservice.service.MsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * ClassName: MsmController
 * Package: com.atguigu.msmservice.controller
 * Description:
 *
 * @Author zzqstart
 * @Create 2023-02-28 23:29
 * @Version 1.0
 */
@RestController
@RequestMapping("/msgservice/msm")
@Api(tags = "阿里云第三方服务——短信服务" )
public class MsgController {

    @Autowired
    private MsgService msgService;

    @GetMapping("/send/{phone}")
    @ApiOperation(value = "发送短信")
    public R sendMsm(@PathVariable String phone){
        boolean isSend = msgService.send(phone);
        if (isSend){
            return R.ok();
        }else
            return R.error().message("发送短信错误");
    }
}
